<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This file documents the GNU linker LD
(Linaro_Binutils-2017.05)
version 2.27.0.

Copyright (C) 1991-2016 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts.  A copy of the license is included in the
section entitled "GNU Free Documentation License". -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>LD: M68HC11/68HC12</title>

<meta name="description" content="LD: M68HC11/68HC12">
<meta name="keywords" content="LD: M68HC11/68HC12">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="LD-Index.html#LD-Index" rel="index" title="LD Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Machine-Dependent.html#Machine-Dependent" rel="up" title="Machine Dependent">
<link href="ARM.html#ARM" rel="next" title="ARM">
<link href="i960.html#i960" rel="prev" title="i960">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="M68HC11_002f68HC12"></a>
<div class="header">
<p>
Next: <a href="ARM.html#ARM" accesskey="n" rel="next">ARM</a>, Previous: <a href="i960.html#i960" accesskey="p" rel="prev">i960</a>, Up: <a href="Machine-Dependent.html#Machine-Dependent" accesskey="u" rel="up">Machine Dependent</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="LD-Index.html#LD-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="ld-and-the-Motorola-68HC11-and-68HC12-families"></a>
<h3 class="section">4.3 <code>ld</code> and the Motorola 68HC11 and 68HC12 families</h3>

<a name="index-M68HC11-and-68HC12-support"></a>

<a name="Linker-Relaxation"></a>
<h4 class="subsection">4.3.1 Linker Relaxation</h4>

<p>For the Motorola 68HC11, <code>ld</code> can perform these global
optimizations when you specify the &lsquo;<samp>--relax</samp>&rsquo; command-line option.
</p>
<dl compact="compact">
<dd><a name="index-relaxing-on-M68HC11"></a>
</dd>
<dt><em>relaxing address modes</em></dt>
<dd><p><code>ld</code> finds all <code>jsr</code> and <code>jmp</code> instructions whose
targets are within eight bits, and turns them into eight-bit
program-counter relative <code>bsr</code> and <code>bra</code> instructions,
respectively.
</p>
<p><code>ld</code> also looks at all 16-bit extended addressing modes and
transforms them in a direct addressing mode when the address is in
page 0 (between 0 and 0x0ff).
</p>
</dd>
<dt><em>relaxing gcc instruction group</em></dt>
<dd><p>When <code>gcc</code> is called with <samp>-mrelax</samp>, it can emit group
of instructions that the linker can optimize to use a 68HC11 direct
addressing mode. These instructions consists of <code>bclr</code> or
<code>bset</code> instructions.
</p>
</dd>
</dl>

<a name="Trampoline-Generation"></a>
<h4 class="subsection">4.3.2 Trampoline Generation</h4>

<a name="index-trampoline-generation-on-M68HC11"></a>
<a name="index-trampoline-generation-on-M68HC12"></a>
<p>For 68HC11 and 68HC12, <code>ld</code> can generate trampoline code to
call a far function using a normal <code>jsr</code> instruction. The linker
will also change the relocation to some far function to use the
trampoline address instead of the function address. This is typically the
case when a pointer to a function is taken. The pointer will in fact
point to the function trampoline.
</p>




</body>
</html>
